#include<stdio.h>

int is_huiwen(int n){
    if(n >= 1 && n <= 9)
        return 1;
    
    int a[8], i = 0;
    int count = -1;
    
    while(n){
        a[i++] = n % 10;
        n /= 10;
        count++;
    }
    int left = 0,right = count;
    while(a[left++] == a[right--]){
        if(left >= right){
            return 1;
        }
    }
    return 0;
}

int main(){
    int i, n;
    scanf("%d", &n);
    
    for(i = 1;i <= n;i++){
        int ret = is_huiwen(i);
        if(ret == 1){
            printf("%d\n",i);
        }
    }
    return 0;
}

/*链接：https://ac.nowcoder.com/acm/problem/22169
来源：牛客网

今天牛牛学到了回文串，他想在数字里面找回文，即回文数，回文数是正着读与倒着读都一样的数，比如1221，343是回文数，433不是回文数。请输出不超过n的回文数。*/